<?php
    session_start();
    if ( intval($_SESSION['uid']) < 1 ){
		
		header("Location: user_login.php");
		die("未登录，请先登录 <a href='user_login.php'>用户登录</a> ");
        //die("未登录，请先登录<script> location = 'user_login.php' </script>");
    }

   

    $dbms='mysql';     //数据库类型
    $host='localhost'; //数据库主机名
    $dbName='fcoucv';    //使用的数据库
    $user='root';      //数据库连接用户名
    $pass='40qGYxok';          //对应的密码
    $dsn="$dbms:host=$host;dbname=$dbName";

    try {
        $dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //设置错误模式
        
        //数据库操作
        $sql = "SELECT * FROM `resume` WHERE uid = ? ";
        $result = $dbh->prepare($sql);
        $result->execute([ intval($_SESSION['uid']) ]);

        //$resume_list = $result->fetchall();
        $result_list = $result->fetchAll();
        //print_r($result_list);
        

    } catch (PDOException $e) {
        die ("Error!: " . $e->getMessage() . "<br/>");
    }

    
?>

<html>

<head>
    <meta charset="utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />  
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的简历列表</title>
    <link rel="stylesheet" type="text/css" media="screen" href="main.css"/> 
    <link rel="stylesheet" type="text/css" media="screen" href="list.css"/>
	<script src=http://lib.sinaapp.com/js/jquery/3.1.0/jquery-3.1.0.min.js></script> 
	<script src="send_form.js"></script>
</head>
<body>

    <div class="header clearfix">
        
        <div class="left">
            <div class="logo">
                我的简历列表
            </div> 
        </div>

        <div class="right">
            <ul class="menu">
                <li><?php print_r($_SESSION['email']) ?></li>
                <li class="active"><a href="user_logout.php">退出登录</a></li>
            </ul>
        </div>

    </div>

    <div class="container_resume">
        <div id="resume_list_notice" class='form_info'></div>
            <?php if($result_list ):  ?>
            <ul class='resume_list'>
            <?php foreach($result_list as $item):  ?>
                <li>
                    <a href="resume_detail.php?id=<?php print_r($item['id']) ?>" class="resume_title" target="_blank"> <?php print_r($item['title']);?> </a>
                    <a href="resume_detail.php?id=<?php print_r($item['id']) ?>"  target="_blank"> <img src="img/open.png" alt="查看"class="resume_img"> </a>
                    <a href="resume_edite.php?id=<?php print_r($item['id']) ?>" target="_blank"> <img src="img/edite.png" alt="修改"class="resume_img"> </a>
                    <a href="javascript:void(0);"  onclick = "send_resume(<?php print_r($item['id']) ?>); return false;"> <img src="img/remove.png" alt="删除" class="resume_img"> </a>
                </li>
            <?php endforeach;  ?>
            </ul>
            <?php endif;  ?>

            <p><img src="img/add.png" alt="新增" class="resume_img"><a href="resume_add.php" class="resume_add" > 添加简历</a></p>
        </div>
    </div>
</body>

</html>